package sctu.edu.java.year2016.team08.chenruixiu.day20160521.chapter4_3;

/**编写Java程序，使用while循环语句计算1+1/2！+1/3!……1/20!之和
 * Created by Administrator on 2016/5/21.
 */
public class three {
    public static void main(String[] args) {
        int i = 1;
        int j = 1;
        double sum = 0;
        int b = 1;
        while (j <= 20) {
            b = b * j;
            sum = sum + 1 / (double) b;
            j++;

        }
        System.out.println(sum);
    }
}
